package com.yunhe.sms.control;

import com.yunhe.sms.dao.TeacherDao;
import com.yunhe.sms.mode.Teacher;
import com.yunhe.sms.view.teacher.TeacherAdd;
import com.yunhe.sms.view.teacher.TeacherDle;
import com.yunhe.sms.view.teacher.TeacherList;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class TeacherController {

    /**
     * 讲师控制主路由
     */
    public static void teacherControlroute(){
        List<Teacher> teacherList = TeacherDao.getAllTeacher();
        int i = TeacherList.teacherListUI(teacherList);
        switch (i){
            case 1:{
                Teacher teacher = TeacherAdd.teacherAddUI();
                TeacherDao.teacherAdd(teacher);//添加讲师
                teacherControlroute();
                break;
            }
            case 2:{
                Teacher teacher = TeacherAdd.teacherAddUI();
                TeacherDao.teacherUpdate(teacher);//修改讲师
                teacherControlroute();
                break;
            }
            case 3:{
                Integer id = TeacherDle.teacherDleUI();
                TeacherDao.teacherDel(id);// 删除讲师
                teacherControlroute();
                break;
            }
            case 4:HomeControllerFactory.homeRoute(UserController.strTypeToInt( LoginController.getCurrUser().getType()));//返回主页
            case 5:teacherControlroute();//刷新
        }
    }
}
